﻿@using GTAuto.DAL.DAL
@using GTAuto.DAL.Entities
@model GTAuto.DAL.Entities.GTModel
@{
    ViewBag.Title = "Model";
    Layout = "~/Views/Shared/_Layout.cshtml";
    SelectList selList1 = ViewBag.Mods1;
    SelectList selList2 = ViewBag.Mods2;
    SelectList selList3 = ViewBag.Mods3;

    List<GTPropertyCategory> activeCats = ViewBag.ActivCategories;
    List<GTModelModificationProperty> modelModificationProperties = ViewBag.ModelModificationProperties;

    string propS = ViewBag.props;
}
<script src="../../Scripts/Helpers/autoModelViewHelper.js" type="text/javascript"></script>
<div id="list">
    @Html.Partial("Controls/BreadCrumbs")
    @Html.Partial("Controls/Favorites")
</div>
<div id="main_left">
    @Html.Action("ModelsVertical", new { @id = Model.BrandId })
</div>
<div id="main_center">
    @Html.Hidden("propS", propS)
    @Html.Hidden("ShowDiffers", "0")
    

    <div class="tabs_wrapper_1">
        <div class="catalog_vntr_title">
            <img src="../../images/audi.jpg" alt="" />
            <div class="audi_text">
                <span>Audi</span>
            </div>
            <div class="clear">
            </div>
        </div>
        <div class="opisanie_modeli">
            <div class="opisanie_modeli_left">
                <img src=@Url.Action("GetInSize181127", "Img", new { @id = Model.Logo }) alt="" />
            </div>
            <div class="opisanie_modeli_right">
                <span>Описание модели:</span> @Model.Description
            </div>
            <div class="clear">
            </div>
        </div>
        <div class="tab_block_1">
            <div class="tab_title">
                <span>Таблица комплектаций авто</span>
            </div>
            <div class="tab">
                <form action="" method="get">
                    <div class="tab_top">
                        <div class="tab_top_1" style="position: relative; height: 19px">
                            <div class="t">
                                Комплектация модели
                                <label>
                                    Выделить отличия :</label>
                               
                                <button  class="button_2" type="button" id="tOff" name="tOff" onclick="turnOffFunction();">
                                    Выкл.</button>
                               
                                <button  class="button_1   active" type="button" id="tOn" name="tOn" onclick="turnOnFunction();">
                                    Вкл.</button>

                                <div class="clear">
                                </div>
                            </div>
                        </div>
                        <div class="tab_top_2 sel">
                            @Html.DropDownList("Type", selList1, new { @class = "selectBlock select_tab", @onchange = "modelChanged(1);", @id = "modelCol1" })
                        </div>
                        <div class="tab_top_3 sel">
                            @Html.DropDownList("Type", selList2, new { @class = "selectBlock select_tab", @onchange = "modelChanged(2);", @id = "modelCol2" })
                        </div>
                        <div class="tab_top_4 sel">
                            @Html.DropDownList("Type", selList3, new { @class = "selectBlock select_tab", @onchange = "modelChanged(3);", @id = "modelCol3" })
                        </div>
                        @*  <div class="tab_top_5 sel">
                        @Html.DropDownList("Type", selList, new { @class = "selectBlock select_tab", @onchange = "modelChanged(4);", @id = "modelCol4" })
                    </div>*@
                        <div class="clear">
                        </div>
                    </div>
                </form>
                @foreach (var cat in activeCats)
                {
                    var props = DALModificationProperty.Singleton.GetByCategory(cat.Id);
                    var gtModelModificationProperties = modelModificationProperties.Where(x => x.ModificationProperty.Category == cat.Id).ToList();
                   
                    
                    <div class="tab_big_block active">
                        <div class="t_1">
                            @cat.Name
                        </div>
                        <div class="tab_vp_block">
                            <table cellpadding="0" cellspacing="0">
                                @foreach (var item in gtModelModificationProperties)
                                {
                                    <tr>
                                        <td class="tab_top_1">
                                            @item.ModificationProperty.Name
                                        </td>
                                        <td class="tab_top_2"  id="@string.Format("td_prop_1_{0}", item.PropertyId)">
                                            <span id="@string.Format("prop_1_{0}", item.PropertyId)"></span>
                                        </td>
                                        <td class="tab_top_3" id="@string.Format("td_prop_2_{0}", item.PropertyId)">
                                            <span id="@string.Format("prop_2_{0}", item.PropertyId)"></span>
                                        </td>
                                        <td class="tab_top_4" id="@string.Format("td_prop_3_{0}", item.PropertyId)">
                                            <span id="@string.Format("prop_3_{0}", item.PropertyId)"></span>
                                        </td>
                                        @*  <td class="tab_top_5" >
                                             <span id="@string.Format("prop_4_{0}",item.PropertyId)"></span>
                                        </td>*@
                                    </tr>
                                }
                            </table>
                        </div>
                    </div>
                }
                <div class="clear">
                </div>
            </div>
            @*<div class="tab_bottom">
                <span class="s_1">Обозначения:</span> <span class="s_2">Серийное оснащение</span>
                <span class="s_3">Не доступно</span>
            </div>*@
        </div>
    </div>
</div>
